//
//  DECXCategory.m
//  DECXInStore
//
//  Created by 程强 on 15/12/14.
//  Copyright © 2015年 程强. All rights reserved.
//

#import "DECXCategory.h"

@implementation DECXCategory
- (instancetype)initWithResponse:(NSDictionary *)dic
{
    if (self = [super init]) {
        self.category_id = dic[@"category_id"];
        self.category_name = dic[@"category_name"];
        NSArray *arr = dic[@"child"];
        NSMutableArray *catAry = @[].mutableCopy;
        for (NSDictionary *cdic in arr) {
            DECXCategory *cat = [[DECXCategory alloc]initWithResponse:cdic];
            [catAry addObject:cat];
        }
        self.child = catAry;
    }
    return self;
}
@end

@implementation DECXPidCategory
- (instancetype)initWithResponse:(NSDictionary *)dic
{
    if (self = [super initWithResponse:dic]) {
        NSArray *ary = dic[@"child"];
        NSMutableArray *categoryAry = [[NSMutableArray alloc]initWithCapacity:0];
        for (NSDictionary *dic in ary) {
            DECXCategory *caty = [[DECXCategory alloc]initWithResponse:dic];
            [categoryAry addObject:caty];
        }
        self.categoryChildAry =categoryAry;
    }
    return self;
}
@end
